﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace Scoot.UI
{
    /// <summary>
    /// Interaction logic for StatusBox.xaml
    /// </summary>
    /// 
   

    public partial class StatusBox : UserControl
    {
        public delegate void StatusChangeHandler(ggdll.GGContacts.GGContactStatusEnum state, string description);
        public event StatusChangeHandler StatusChanged;
        public StatusBox()
        {
            InitializeComponent();
        }

        private void Unavaible_Click(object sender, RoutedEventArgs e)
        {
            StatusChanged(ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_NOT_AVAIL, "");
        }

        private void Invisible_Click(object sender, RoutedEventArgs e)
        {
            StatusChanged(ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_INVISIBLE, "");
        }

        private void Away_Click(object sender, RoutedEventArgs e)
        {
            StatusChanged(ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_BUSY, "");
        }

        private void Busy_Click(object sender, RoutedEventArgs e)
        {
            StatusChanged(ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_DND, "");
        }

        private void LetsTalk_Click(object sender, RoutedEventArgs e)
        {
            StatusChanged(ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_FFC, "");
        }

        private void Avaible_Click(object sender, RoutedEventArgs e)
        {
            StatusChanged(ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_AVAIL, "");
        }

        public void changeIcon(ggdll.GGContacts.GGContactStatusEnum state)
        {
            Dispatcher.Invoke(DispatcherPriority.Background,
                                  new Action(() =>
                                  {
                                      switch (state)
                                      {
                                          case ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_AVAIL:
                                              UserStatusImage.Source = Statics.IconAvaible;
                                              break;
                                          case ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_FFC:
                                              UserStatusImage.Source = Statics.IconFFC;
                                              break;
                                          case ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_DND:
                                              UserStatusImage.Source = Statics.IconDND;
                                              break;
                                          case ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_BUSY:
                                              UserStatusImage.Source = Statics.IconAway;
                                              break;
                                          case ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_INVISIBLE:
                                              UserStatusImage.Source = Statics.IconInvisible;
                                              break;
                                          case ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_NOT_AVAIL:
                                              UserStatusImage.Source = Statics.IconUnavaible;
                                              break;
                                      }
                                  }));
        }
    }
}
